package org.hbbTlias2025.controller;

import lombok.extern.slf4j.Slf4j;
import org.hbbTlias2025.pojo.Result;
import org.hbbTlias2025.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("/report")
@RestController
public class reportController {

    @Autowired
    private ReportService reportService;


    @GetMapping("/empJobData")
    public Result getEmpJobData() {
        log.info("查询所有员工信息");
        try {
            return Result.success(reportService.getEmpJobData());
        } catch (Exception e){
            return Result.error("员工信息查询失败了5555"+ e.getMessage());
        }

//        return Result.error("未知错误我抄");
    }


    @GetMapping("/empGenderData")
    public Result getEmpGenderData() {
        log.info("查询所有员工性别和人数我抄");
        try {
            return Result.success(reportService.getEmpGenderData());
        } catch (Exception e){
            return Result.error("性别查询失败了5555"+ e.getMessage());
        }
    }


    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeData() {
        log.info("查询所有学生学历和数量我抄");
        try {
            return Result.success(reportService.getStudentDegreeData());
        } catch (Exception e){
            return Result.error("学历查询失败了5555"+ e.getMessage());
        }

    }

    @GetMapping("/studentCountData")
    public Result getStudentCountData() {
        log.info("查询所有班级的人数哈哈哈");
        try {
            return Result.success(reportService.getStudentCountData());
        } catch (Exception e){
            return Result.error("班级人数查询失败了5555"+ e.getMessage());
        }
    }

}
